package com.example.xm.adapter.HomeAdapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.example.xm.R;
import com.example.xm.base.BaseAdapter;
import com.example.xm.bean.HomeBean.HomeYouHomeTrendBean;
import com.example.xm.utiles.SystemUtils;

import java.util.List;

public class YouHomeTrendImageAdapter extends BaseAdapter {
    public YouHomeTrendImageAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.layout_image_item;
    }

    @Override
    protected void bindData(BaseViewHolder viewHolder, Object o) {
        ImageView img = (ImageView) viewHolder.getViewById(R.id.iv_image);
        HomeYouHomeTrendBean.DataBean.DynamicsBean.ImagesBean imagesBean = (HomeYouHomeTrendBean.DataBean.DynamicsBean.ImagesBean) o;
        //设置头像是圆角
        int round = SystemUtils.dp2px(context,20);
        RoundedCorners roundedCorners = new RoundedCorners(round);
        RequestOptions requestOptions = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(context).load(imagesBean.getFilePath()).apply(requestOptions).into(img);
    }
}
